package scala.test_traits.test_abstract_type

/**
 * @author 黄海峰 2021/4/19 15:32
 * */
object DeanTest {
  def main(args: Array[String]): Unit = {
    val buf = newIntSeqBuf(7, 8)
    println("length = " + buf.length)
    println("content = " + buf.element)
  }

  /**
   * 工厂方法
   * @param elem1 第一个参数
   * @param elem2 第二个参数
   * @return element
   */
  def newIntSeqBuf(elem1: Int, elem2: Int): IntSeqBuffer =
    new IntSeqBuffer {
      type T = List[U]
      val element = List(elem1, elem2)
    }
}
